{extend name="admin/layout" /}
{block name="main"}
<div class="row">
    <div class="col-sm-12">
        <h4 class="page-title">
            <ul class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="/"> 首页</a></li>
                <li><i class="fa fa-desktop"></i><a href="{:url('index')}"> 管理后台</a></li>
                <li class="active">在线支付配置</li>
            </ul>
        </h4>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-info">
            <div class="panel-heading">
                在线支付配置
            </div>
            <div class="panel-body">
                <form role="form" class="form-horizontal" method="post">
                    <div class="form-group">
                        <label class="col-lg-3 control-label">支付宝即时到账</label>
                        <div class="col-lg-8">
							<select class="form-control" name="alipay_api" default="{:config('zz_alipay_api')}"><option value="0">关闭</option><option value="1">支付宝官方即时到账接口</option><option value="2">彩虹易支付免签约接口</option></select>
                        </div>
                    </div>
					<div id="payapi_01" style="{if condition="config('zz_alipay_api') neq 1"}display:none;{/if}">
                    <div class="form-group">
                        <label class="col-lg-3 control-label">收款人支付宝账号</label>
                        <div class="col-lg-8">
                            <input type="text" name="alipay_account" class="form-control"
                                   value="{:config('zz_alipay_account')}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-3 control-label">合作者身份(PID)</label>
                        <div class="col-lg-8">
                            <input type="text" name="alipay_pid" class="form-control" value="{:config('zz_alipay_pid')}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-3 control-label">安全校验码(Key)</label>
                        <div class="col-lg-8">
                            <input type="text" name="alipay_key" class="form-control" value="{:config('zz_alipay_key')}">
                        </div>
                    </div>
					<div class="form-group">
                        <label class="col-lg-3 control-label">支付宝手机网站支付</label>
                        <div class="col-lg-8">
							<select class="form-control" name="alipay2_api" default="{:config('zz_alipay2_api')}"><option value="0">关闭</option><option value="1">支付宝官方手机网站支付接口</option></select>
							<pre id="payapi_02"  style="{if condition="config('zz_alipay2_api') neq 1"}display:none;{/if}">相关信息与以上支付宝即时到账接口一致，开启前请确保已开通支付宝手机支付，否则会导致手机用户无法支付！</pre>
                        </div>
                    </div>
					</div>

					<div class="form-group">
                        <label class="col-lg-3 control-label">财付通即时到账</label>
                        <div class="col-lg-8">
							<select class="form-control" name="tenpay_api" default="{:config('zz_tenpay_api')}"><option value="0">关闭</option><option value="1">财付通官方即时到账接口</option><option value="2">彩虹易支付免签约接口</option></select>
                        </div>
                    </div>
					<div id="payapi_03" style="{if condition="config('zz_tenpay_api') neq 1"}display:none;{/if}">
                    <div class="form-group">
                        <label class="col-lg-3 control-label">财付通商户号</label>
                        <div class="col-lg-8">
                            <input type="text" name="tenpay_pid" class="form-control"
                                   value="{:config('zz_tenpay_pid')}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-3 control-label">财付通密钥</label>
                        <div class="col-lg-8">
                            <input type="text" name="tenpay_key" class="form-control" value="{:config('zz_tenpay_key')}">
                        </div>
                    </div>
					</div>

					<div class="form-group">
                        <label class="col-lg-3 control-label">QQ钱包支付接口</label>
                        <div class="col-lg-8">
							<select class="form-control" name="qqpay_api" default="{:config('zz_qqpay_api')}"><option value="0">关闭</option><option value="1">QQ钱包官方即时到账接口</option><option value="2">彩虹易支付免签约接口</option></select>
                        </div>
                    </div>
					<div id="payapi_05" style="{if condition="config('zz_qqpay_api') neq 1"}display:none;{/if}">
                    <div class="form-group">
                        <label class="col-lg-3 control-label">QQ钱包商户号</label>
                        <div class="col-lg-8">
                            <input type="text" name="qqpay_pid" class="form-control"
                                   value="{:config('zz_qqpay_pid')}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-3 control-label">QQ钱包密钥</label>
                        <div class="col-lg-8">
                            <input type="text" name="qqpay_key" class="form-control" value="{:config('zz_qqpay_key')}">
                        </div>
                    </div>
					</div>

					<div class="form-group">
                        <label class="col-lg-3 control-label">微信支付接口</label>
                        <div class="col-lg-8">
							<select class="form-control" name="wxpay_api" default="{:config('zz_wxpay_api')}"><option value="0">关闭</option><option value="1">微信官方即时到账接口</option><option value="2">彩虹易支付免签约接口</option></select>
							<pre id="payapi_04"  style="{if condition="config('zz_wxpay_api') neq 1"}display:none;{/if}"><font color="green">*微信即时到账相关信息配置请修改includes/wxpay/WxPay.Config.php</font></pre>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-lg-offset-3 col-lg-8">
                            <button class="btn btn-primary" type="submit">保存配置</button>
                            <button class="btn btn-default-outline" type="reset">重置</button>
                        </div>
                    </div>
                </form>
			  </div>
            </div>
        </div>
		</div>
		{if condition="config('zz_alipay_api') eq 2 or config('zz_tenpay_api') eq 2 or config('zz_qqpay_api') eq 2 or config('zz_wxpay_api') eq 2"}
		<div class="panel panel-info">
            <div class="panel-heading">
                彩虹易支付配置
            </div>
            <div class="panel-body">
                <form role="form" class="form-horizontal" method="post">
					<div class="form-group">
                        <label class="col-lg-3 control-label">彩虹易支付商户ID</label>
                        <div class="col-lg-8">
                            <input type="text" name="epay_pid" class="form-control"
                                   value="{:config('zz_epay_pid')}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-3 control-label">彩虹易支付商户密钥</label>
                        <div class="col-lg-8">
                            <input type="text" name="epay_key" class="form-control" value="{:config('zz_epay_key')}">
                        </div>
                    </div>
					<div class="form-group">
                        <div class="col-lg-offset-3 col-lg-8">
                            <button class="btn btn-primary" type="submit">保存配置</button>
                            <button class="btn btn-default-outline" type="reset">重置</button>
                        </div>
                    </div>
				</form>
            </div>
        </div>
		{/if}
    </div>
</div>
<script>
$("select[name=\'alipay_api\']").change(function(){
	if($(this).val() == 1){
		$("#payapi_01").css("display","inherit");
	}else{
		$("#payapi_01").css("display","none");
	}
});
$("select[name=\'tenpay_api\']").change(function(){
	if($(this).val() == 1){
		$("#payapi_03").css("display","inherit");
	}else{
		$("#payapi_03").css("display","none");
	}
});
$("select[name=\'wxpay_api\']").change(function(){
	if($(this).val() == 1){
		$("#payapi_04").css("display","inherit");
	}else{
		$("#payapi_04").css("display","none");
	}
});
$("select[name=\'qqpay_api\']").change(function(){
	if($(this).val() == 1){
		$("#payapi_05").css("display","inherit");
	}else{
		$("#payapi_05").css("display","none");
	}
});
$("select[name=\'alipay2_api\']").change(function(){
	if($(this).val() == 1){
		$("#payapi_02").css("display","inherit");
	}else{
		$("#payapi_02").css("display","none");
	}
});
</script>
<script>
var items = $("select[default]") || 0;
for (i = 0; i < items.length; i++) {
	$(items[i]).val($(items[i]).attr("default")||0);
}
</script>
{/block}
